package com.yjweb.webportal.controller;

import com.yjweb.webportal.entities.Contacts;
import com.yjweb.webportal.service.CaseService;
import com.yjweb.webportal.service.ContactsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HomeController {
    @Autowired
    private CaseService caseService;
    @Autowired
    private ContactsService contactsService;
    @RequestMapping("/")
    ModelAndView home(){
        ModelAndView mav  = new ModelAndView("home");
        Contacts contacts =contactsService.getAllContactsInfo();
        mav.addObject("contacts",contacts);
        mav.addObject("cases",caseService.getAllCaseInfo());
        return mav;
    }
}
